export const getNewsList = async (num)=>{
    try {
        const response = await uni.request({
            url: `https://push.cj.sina.cn/msg/weibo/v1/list?num=${num}`,
            method: 'GET',
        })

        if (response.statusCode === 200 && response.data) {
            
            const {data:{list}} = response.data;
            
            return list;
		}
		return [];
    } catch (error) {
        console.error('获取新闻数据失败:', error);
        return [];
    }
}

export const getMessageList = async ()=>{
	try{
		const response = await uni.request({
			url: 'https://np-listapi.eastmoney.com/comm/web/getNewsByColumns?client=web&biz=web_news_col&column=353&order=1&needInteractData=0&page_index=1&page_size=20&req_trace=1749284578310&fields=code,showTime,title,mediaName,summary,image,url,uniqueUrl,Np_dst&types=1,20'
		})
		if(response.statusCode === 200 && response.data){
			const {data:{list}} = response.data
			return list
		}
	}catch(error){
		console.error('',error);
		return []
	}
}

// export const sendSmsCode = async (phone) => {
//     try {
//         const response = await uni.request({
//             url: `https://api.example.com/sendSms?phone=${phone}`,
//             method: 'POST',
//         });

//         if (response.statusCode === 200 && response.data) {
//             return true;
//         }
//         return false;
//     } catch (error) {
//         console.error('发送验证码失败:', error);
//         return false;
//     }
// }